using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;


[CustomEditor(typeof(Enemy3DSoldier))]
public class Enemy3DSoldierEditor : Editor
{
    public override void OnInspectorGUI()
    {
        this.serializedObject.Update();
        Enemy3DSoldier a=(Enemy3DSoldier)target;
        EditorGUILayout.PropertyField(this.serializedObject.FindProperty("behavior"));
        if(a.behavior==Enemy3DSoldier.Behavior.LineUpFire){
            EditorGUI.indentLevel++;
            SerializedProperty noInLineUp=this.serializedObject.FindProperty("noInLineUp");
            SerializedProperty countOfLineUp = this.serializedObject.FindProperty("countOfLineUp");

            // EditorGUILayout.LabelField("ffff");
            noInLineUp.intValue=EditorGUILayout.IntField("队列中的位置",noInLineUp.intValue);
            if(noInLineUp.intValue<1){
                noInLineUp.intValue=1;
            }
            if(noInLineUp.intValue>countOfLineUp.intValue){
                countOfLineUp.intValue=noInLineUp.intValue;
            }
            countOfLineUp.intValue = EditorGUILayout.IntField("队列大小",countOfLineUp.intValue);
            if (countOfLineUp.intValue < 1)
            {
                countOfLineUp.intValue = 1;
            }
            if(countOfLineUp.intValue<noInLineUp.intValue){
                noInLineUp.intValue=countOfLineUp.intValue;
            }
            EditorGUI.indentLevel--;
        }
        EditorGUILayout.PropertyField(this.serializedObject.FindProperty("groundLayer"));
        EditorGUILayout.PropertyField(this.serializedObject.FindProperty("health"));
        EditorGUILayout.PropertyField(this.serializedObject.FindProperty("jumpDirectionSpeed"));
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.PropertyField(this.serializedObject.FindProperty("red"));
        if(a.red){
            EditorGUILayout.PropertyField(this.serializedObject.FindProperty("bulletType"));
        }
        EditorGUILayout.EndHorizontal();

        this.serializedObject.ApplyModifiedProperties();



        // base.OnInspectorGUI();
    }
}
